package com.ityy.ruiji.dao;

import com.ityy.ruiji.entity.Category;
import org.apache.ibatis.annotations.*;

import java.util.List;


public interface CategoryDao {
    @Select("select * from category order by sort asc")
    List<Category> findAll();

    @Insert("insert into category values(null,#{type},#{name},#{sort},#{createTime},#{updateTime},#{createUser},#{updateUser})")
    int save(Category category);

    @Delete("delete from category where id = #{id}")
    int deleteById(Long id);

    @Update("update category set name=#{name},sort=#{sort},update_time=#{updateTime},update_user=#{updateUser} where id = #{id}")
    int updateById(Category category);

    @Select("select * from category where id = #{id}")
    Category findById(Long categoryId);


    List<Category> list(Integer type);
}
